package com.ludomancy.archeologyrpg;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;

import com.ludomancy.gamelib.BarPainter;
import com.ludomancy.gamelib.GameCanvas;
import com.ludomancy.gamelib.Theme;

public class GameTheme extends Theme
{
	public Font textFont; //= new Font("Verdana",Font.BOLD, 12);
	public Font idleBarFont; //= new Font("Verdana",Font.BOLD, 12);
	public Font tinyFont;
	
	public static GameTheme theme;
	
	public GameTheme()
	{
		theme = this;
		
		defaultFont = new Font("Tahoma",Font.BOLD, 14);
		try
		{
			textFont = defaultFont.deriveFont(Font.BOLD, 14 );
			idleBarFont = textFont.deriveFont(Font.PLAIN, 14 );
			defaultFont = textFont.deriveFont(Font.PLAIN, 18 );
			tinyFont = textFont.deriveFont(Font.BOLD, 11 );
		}
		catch (Exception e)
		{
		}
		
	}
	
	public void paintBar(Graphics g, int px, int py, int value, int max)
	{
		if(value != 0)
		{
			int width = (Game.ENTITY_TILE_SIZE)+ 5; 
			Rectangle barArea = BarPainter.paint(g, g.getColor(), px, py, width, 5, value, max, BarPainter.HCENTER);
			g.setColor(Color.GRAY);
			g.drawRect(barArea.x, barArea.y, width, barArea.height);
		}
	}
	
	public Color getStatusbarBorderColor()
	{
		return Color.LIGHT_GRAY;
	}
	
	public void fillStatusbarBackground(Graphics g, Rectangle area)
	{
		g.setColor(GameCanvas.screen.theme.getUIBackgroundColor());
		g.fillRect(0, 0, area.width, area.height);
		g.setColor(getStatusbarBorderColor());
		g.drawRect(0, 0, area.width-1, area.height-1);
	}
	
	public void fillUIBackground(Graphics g, Rectangle area)
	{
		g.setColor(getUIBackgroundColor());
		g.fillRoundRect(0, 0, area.width, area.height, 10, 10);
		g.setColor(getDefaultBorderColor());
		g.drawRoundRect(0, 0, area.width-1, area.height-1, 10, 10);
	}
	
	public Color getDefaultTextColor()
	{
		return new Color(0xFAAB19);
	}
	
	public Color getDefaultBorderColor()
	{
		return Color.WHITE;
	}
	
	public Color getUIBackgroundColor()
	{
		return new Color(100, 100, 100);
	}
	
	public void fillButton(Graphics g, Rectangle area, boolean etched)
	{
		Graphics2D g2 = (Graphics2D) g;
		g2.setColor(new Color(100, 100, 100));
		g2.fill3DRect(0, 0, area.width-1, area.height-1, !etched);
	}
}
